package driving.myuall;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class HandleUnivImgs {
	static String newForlder = "E:/高绪国/资料/images/myuall/icon/";
	
	public static void main(String[] args) {
		handleImg();
	}
	
	private static void handleImg() {
		File file = new File("E:/高绪国/资料/images/myuall/icon_1");
		for(String fn : file.list()) {
			System.out.println(fn);
			try {
				createImg(fn);
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
	
	private static void createImg(String fileName) throws IOException {
		File file = new File("E:/高绪国/资料/images/myuall/icon.jpg");
		InputStream is = new FileInputStream(file);
		
		byte[] bs = new byte[1024];
		    // 读取到的数据长度
		    int len;
		    String filePath = newForlder + fileName;
		    File file1 = new File(filePath);
		    // 输出的文件流
		    OutputStream os = new FileOutputStream(file1);
		    // 开始读取
		    while ((len = is.read(bs)) != -1) {
		      os.write(bs, 0, len);
		    }
		    
		    // 完毕，关闭所有链接
		    os.close();
			try {
				is.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
	}
}
